package com.song.springcloud.service;

import com.song.springcloud.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Feign客户端负载均衡   声明式的web service客户端 接口+注解方式实现
 * Ribbon客户端负载均衡  微服务名称
 */
@Service(value = "UserClientService")            // 用户客户端服务后备工厂：fallback指定服务降级的处理实现类
@FeignClient(value = "SPRINGCLOUD-PROVIDER-USER", fallbackFactory = UserClientServiceFallbackFactory.class)
public interface UserClientService {

    @GetMapping("/user/get/{id}")
    public User queryById(@PathVariable("id") Long id);

    @GetMapping("/user/list")
    public List<User> queryAll();

    @PostMapping("/user/add")
    public Boolean addUser(User user);
}
